<?php
class Application_Form_RelatorioFaturamento_Busca extends Zend_Form {

    public function init(){
        $this->setMethod ( 'post' );
        $this->setName ( 'Fernando' );
        $this->setAction('consulta/lista');

        $dtInicioMes = new Zend_Form_Element_Select("dt_inicioMes");
        $dtInicioMes->setLabel("Data de Início");
        $dtInicioMes->addMultiOptions($this->getMonth());
        $this->addElement($dtInicioMes);

        $dtInicioAno = new Zend_Form_Element_Select("dt_inicioAno");
        $dtInicioAno->addMultiOptions($this->getYear());
        $this->addElement($dtInicioAno);

        $dtFimMes = new Zend_Form_Element_Select("dt_fimMes");
        $dtFimMes->setLabel("Data de Fim");
        $dtFimMes->addMultiOptions($this->getMonth());
        $this->addElement($dtFimMes);

        $dtFimAno = new Zend_Form_Element_Select("dt_fimAno");
        $dtFimAno->addMultiOptions($this->getYear());
        $this->addElement($dtFimAno);

        $btnSalvar = new Zend_Form_Element_Submit ( 'fernandinho' );
        $btnSalvar->setLabel("Gerar Relatório");
        $btnSalvar->setAttrib("class", "btn-large");
        $this->addElement($btnSalvar);
    }

    private function getMonth(){

        $model = Application_Model_RelatorioFaturamento::getInstance();
        $lista = $model->GetMonth();
        foreach ($lista as $key => $value) {
            $retorno[$value['value']] = $value["mes"];
        }
        return $retorno;

    }

    private function getYear(){

        $model = Application_Model_RelatorioFaturamento::getInstance();
        $lista = $model->getYear();
        foreach ($lista as $value) {    
            $retorno[$value] = $value;
        }
        return $retorno;
    }

     

}